from django.db import models
import django.utils.timezone as timezone
from ckeditor.fields import RichTextField

# Create your models here.


class Tag(models.Model):
    tagName = models.CharField(max_length=40, primary_key=True)

    def __str__(self):
        return str(self.tagName)


class Author(models.Model):
    author = models.CharField(max_length=20, primary_key=True)

    def __str__(self):
        return str(self.author)


class Passage(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=100)
    time = models.DateTimeField(default=timezone.now)
    content = RichTextField()
    author = models.ForeignKey(Author, default=None)
    Tags = models.ManyToManyField(Tag)

    def __str__(self):
        return str(self.title)